HYweibo Debug Log

Weibo debug log

  1. tapping retweeted text is not calling touches began

    1. on iPhone we cannot lunch so we disabled debug in scheme. Causing we think didn’t triger.

    2. Because we used notification to call didSelectRow

    3. we couldnot call didSelectRow before so we used notification

  1. Repost API is forbiden.

    1. 2019-03-17 17:04:45
  2. 1.Button IBAction was not being called

    1. 1.1 Button titles can’t be changed

    2. 1.2 Reinstall app titles are changed, still can’t call IBActions

    3. 1.3.2019-03-17 11:43:23

  1. Home85 Status detail didSelectRow doesn’t pop when clicking StatusLabel

    1. Other subviews in the cell is working.
    2. set all views containing statusLabel userInteractionEnabled = NO; no luck.
    3. -[HYStatusCell copyWithZone:] using Notification causing this. infoKey was set wrong
    4. added Notification.but causing unwanted segue to first cell in tableView.
  2. Home78.6.background view show after scroll instead of at once.

  3. Compose67. Recent Emotions doesn’t show.

    1. directory didn’t encode, deleting saved file, save again, worked.
  4. Compose67. crash on selecting emotion

    1. encode to file crash if code is nil. judge before encode.
  5. Compose65.Emoji doesn’t show in popView.

    1. title color set to clear color causing not showing
    2. font size causing not showing correctly
  6. Exception on click emotionToolbarButton

    1. Terminating app due to uncaught exception ‘keyValuesArray is not a NSArray - keyValuesArray不是一个数组’, reason: ‘keyValuesArray is a (null) - keyValuesArray参数是一个(null)’
    2. plist path is wrong.
    3. create reference instead of create groups, worked. keep the folder in project blue!
  7. Compose-60 EmotionIcons added causing crash.

    1. img img img
    2. copy files to root directorythen droped files to project caused problem.
    3. drop to project directly worked on iPhone.
    4. simulator can’t lunch, waiting iPhone6 to start.
    5. create reference instead of create groups, worked. keep the folder in project blue!
  8. Home-58 MJPhotoBrowser pageControl number error.

    1. page 2 doesn’t turn correctly in simulator, but it’s working in iPhone.
    2. 2019-02-22

1. id and secret

1.1. composeVC CZ
1
2
// 拼接URL字符串
NSString *urlStr = [NSString stringWithFormat:@"%@?client_id=%@&redirect_uri=%@",CZAuthorizeBaseUrl,CZClient_id,CZRedirect_uri];

2. account key add isRealName

Using this class is not key value coding-compliant for the key isRealName.
1
2
3
4
5
6
7
8
/**
* added by HY 2018-12-19 13:49:10
*
* Using MJExtension, will encode all keys in returned dict, when sina updated API
* without this property will pop an error when encode an acount
* this class is not key value coding-compliant for the key isRealName.
*/
@property (nonatomic, copy) NSString *isRealName;

3.CZ New feature page control center fix

1
control.center = CGPointMake(self.view.width * 0.5, self.view.height * 0.97);

4.CZ tabbar lost items

  • the default tabbar is not removed.

5.The app’s Info.plist must contain an NSPhotoLibraryAddUsageDescription key with a string value explaining to the user how the app uses this data.

  • Error:
    • This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSPhotoLibraryAddUsageDescription key with a string value explaining to the user how the app uses this data.
  • Reason
    • Code 27.6 (below) adding photo to Library needs discription to user
  • Fix:
    • add this key to plist
    • Privacy Photo Libaray Addition Usage Discription
      Our application needs permission to write photos…
1
2
3
4
5
6
7
8
9
10
11
/**
27.6.addPhotoToAlbum for test
*/
-(void)addPhotoToAlbum
{
for (int i = 0; i<5; i++) {
NSString *name = [NSString stringWithFormat:@"minion_0%d", i + 1];
UIImage *image = [UIImage imageNamed:name];
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
}
}

6.replace UIWebView with WKWebView (UIWebview is deprecated in iOS12! ) 2018-12-21 16:31:44

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// 1. import
#import <WebKit/WebKit.h>
// 2. WKNavigationDelegate
@interface HYOAuthViewController () <WKNavigationDelegate>
// 3.navigationDelegate
webView.navigationDelegate = self;
// 4.
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {

NSString *url = [navigationAction.request.URL absoluteString];

NSString *str = [NSString stringWithFormat:@"%@/?code=",HYRedirectURI];
NSRange range = [url rangeOfString:str];
if (range.location != NSNotFound) {
//14.3.2.get requeset code
int from = range.location + range.length;
NSString *code = [url substringFromIndex:from];
HYLog(@"%@",code);

//14.3.3.get accessToken with code
[self accessTokenWithCode:code];
decisionHandler(WKNavigationActionPolicyCancel);
return;
}

decisionHandler(WKNavigationActionPolicyAllow);

}

7. Auth went to redirect URL, the reason is redirect URL changed has a “/“ lost.

  1. This happened when testing on a real iPhone
  2. We should test on simulator first.
  3. if it works
  4. Then we doubt it’s a real iPhone issue!

8. new Xcode git can’t commit

  • using old Xcode commit, said need configure name and email
  • configured, can commit
  • new Xcode can commit after reload.

9.Property ‘access_token’ cannot be found in forward class object ‘Account’

1
2
//need import Account in ComposeVC too
#import "Account.h"

10.NSLocalizedDescription=Request failed: forbidden (403) sendWeibo, API changed.2018-12-23 23:34:17

1
2
3
4
5
// set safe domain for app first then change this:
params[@"status"] = [_textView.text stringByAppendingString:@"from http://heavenyu.com"];

// 3. Get request
[mgr POST:@"https://api.weibo.com/2/statuses/share.json"

11.account can’t be saved

  • API changed!
  • access_token, doesn’t return expires_time, so account is set to nil after
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
+(HYAccount *)account
{

HYAccount *account = [NSKeyedUnarchiver unarchiveObjectWithFile:HYAccountFilePath];

if (account) {
NSDate *now = [NSDate date];

//16.2.1.compare date
if ([now compare:account.expires_time] != NSOrderedAscending) {
account = nil;
}
}
return account;
}

12.application icon badge number not showing

1
2
3
4
    // 34.8 UIUserNotificationTypeBadge
UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];

[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];

13.tabBar home clicked again, but not refreshing

  1. debug , found delegate method not called
  2. so it’s delegate not seted!!!!

14.-[UITableView _contentOffsetForScrollingToRowAtIndexPath:atScrollPosition:usingPresentationValues:]: row (0) beyond bounds (0) for section (0).

  1. tableView is not showing at all! no section to scroll
  2. pull to refresh first

15.not scrolling to top if default postion is scrolled down

  1. default is set to do so
  2. we can set to scroll to top like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
#pragma mark - 34.10
- (void)refresh:(BOOL)fromSelf
{
if (self.tabBarItem.badgeValue) {
// [self.refreshControl beginRefreshing];
[self loadNewStatuses:self.refreshControl];
NSIndexPath *firstRow = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView scrollToRowAtIndexPath:firstRow atScrollPosition:UITableViewScrollPositionTop animated:YES];
} else if (fromSelf) {
NSIndexPath *firstRow = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView scrollToRowAtIndexPath:firstRow atScrollPosition:UITableViewScrollPositionTop animated:YES];
}
}

16.file not found, even the file is there

  1. remove the folder
  2. add the folder again

keyValuesArray is null

回滚

xcode new branch from commit

terminal

1
2
git reset --hard 
git push origin new branch

gitee 设置默认分支

重新clone

Socket SO_ERROR [54: Connection reset by peer

断网了.

Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.’

This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes.

17.sqlite error 20 由于count没设置。

2020-05-11 21:13:29

18.防止view滚出屏幕,不判断会出错

1
2
3
4
5
6
7
### // 99.19.防止view滚出屏幕,textView添加在屏幕外

if (self.messages.count > 0) { //不判断会出错

[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];

}

19.Collection <__NSArrayM: 0x600000d2bfc0> was mutated while being enumerated.

20.记事没保存

新建没保存